package leecode

import "math"

func maxProfit121(prices []int) int {
	low := math.MaxInt
	var result int
	for i := 0; i < len(prices); i++ {
		low = min(low, prices[i]) //最低买入 最高卖出
		result = max(result, prices[i]-low)
	}
	return result
}
